/**
 * 
 */
package com.alkandros.linesmash.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.alkandros.linesmash.R;
import com.alkandros.linesmash.interfaces.IConstants;
import com.alkandros.linesmash.interfaces.IURLConstants;
import com.alkandros.linesmash.location.GPSTracker;
import com.alkandros.linesmash.manager.CustomProgressDialog;

/**
 * @author Jiju Induchoodan
 *
 */
public abstract class BaseActivity extends Activity implements IURLConstants,IConstants
{
	
	
	 protected TextView txtHeading;
	 protected Button  btnLeft;
	 protected Button  btnRight;
	 protected ImageView imgCart;
	 Context context;
	 CustomProgressDialog progress;
	 SharedPreferences mPrefs;
     SharedPreferences.Editor mEditor;
     protected boolean mUpdatesRequested = false;
     protected GPSTracker gps;
	 
	 @Override
	protected void onCreate(Bundle savedInstanceState) 
	  {
	     super.onCreate(savedInstanceState);
	     context 		=this;
	     progress		= CustomProgressDialog.show(context, false);
	     
	     if(gps==null)
	     gps = new GPSTracker(BaseActivity.this);
	  }
	
	
	  @Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		
	}


	protected void setHeading(int resId) {
	     if(txtHeading == null)
	     txtHeading = (TextView) findViewById(R.id.heading1);
	     if(txtHeading != null)
	     {
	    	 txtHeading.setText(resId);
	    	 txtHeading.setSelected(true);
	     }
	  }
	  
	  protected void setHeading(String text) {
		     if(txtHeading == null)
		     txtHeading = (TextView) findViewById(R.id.heading1);
		     if(txtHeading != null)
		       txtHeading.setText(text);
		  }
	  
	  protected void setLeftButton() {
		     if(btnLeft == null)
		    	 btnLeft = (Button) findViewById(R.id.btn_left);
		     if(btnLeft != null)
		     {
		    	 btnLeft.setOnClickListener(new OnClickListener() {
						@Override
						public void onClick(View v) {
						finish();
						}
					});
		     }
		  }
	  protected void setRightButton() {
		     if(btnRight == null)
		    	 btnRight = (Button) findViewById(R.id.btn_right);
		  //   if(btnLeft != null)
		      // txtHeading.setText(resId);
		  }
	  
	  protected void setCartButton() {
		     if(imgCart == null)
		    	 imgCart = (ImageView) findViewById(R.id.img_checkout);
		     if(imgCart != null)
		    	 imgCart.setVisibility(View.VISIBLE);
		  }
	 
	 
}
